﻿using System;

namespace HomeService.Models
{
    public class ServiceRequestBasicInfo : ViewModelBase
    {
        private string _name;
        private string _streetAddress;
        private string _postalCode;
        private string _city;
        private string _phone;
        private string _email;
        private string _description;

        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                NotifyPropertyChanged("Name");
            }
        }

        public string StreetAddress
        {
            get { return _streetAddress; }
            set
            {
                _streetAddress = value;
                NotifyPropertyChanged("StreetAddress");
                NotifyPropertyChanged("Address");
            }
        }

        public string PostalCode
        {
            get { return _postalCode; }
            set
            {
                _postalCode = value;
                NotifyPropertyChanged("PostalCode");
                NotifyPropertyChanged("Address");
            }
        }

        public string City
        {
            get { return _city; }
            set
            {
                _city = value;
                NotifyPropertyChanged("City");
                NotifyPropertyChanged("Address");
            }
        }

        public string Phone
        {
            get { return _phone; }
            set
            {
                _phone = value;
                NotifyPropertyChanged("Phone");
            }
        }

        public string Email
        {
            get { return _email; }
            set
            {
                _email = value;
                NotifyPropertyChanged("Email");
            }
        }

        public string Description
        {
            get { return _description; }
            set
            {
                _description = value;
                NotifyPropertyChanged("Description");
            }
        }

        public string Address
        {
            get { return string.Format("{0}{1}{2} {3}", StreetAddress, Environment.NewLine, PostalCode, City); }
        }

        public void Clear()
        {
            Name = "";
            StreetAddress = "";
            PostalCode = "";
            City = "";
            Phone = "";
            Email = "";
            Description = "";
        }
    }
}